<?php
/**
 * Remove a document from a ressource
 * 
 * @author	Xavier VILAIN
 * @package Contact\Interview
 * @license #hive-contact#
 */
use Fox\Behaviors;
use Hive\Ressource;
use Fox\Generator;
use Fox\Popup\ToConfirm\Deletion;
$xview = Xview::instance();

$popup = new Deletion('pDelete',
			Hive\Ressource\Interview::className(),			
			Msg(Fox\Msg::BUNDLE,Fox\Msg::MSG_DELETE_HDR),
			array(Fox\Msg::BUNDLE,Fox\Msg::MSG_DELETE_MSG_CONF),
			array(Fox\Msg::BUNDLE,Fox\Msg::MSG_DELETE)
			,Generator::ajaxReload('contentCol')
			);
$popup->deletionGenerator(Generator::useFunction(function($interview) {
	Hive\Ressource::className();//Build the link
	$contact = $interview->ressource();
	$contact->deleteFromInterviews($interview);
	$contact->prepareUpdate(Hive\Ressource::CHANGE_INTERVIEW_DELETE);
	$contact->update();
}));
echo $popup->render();